package h0827;
/**
  * @description 爬楼梯
  * @author 不知名帅哥
  * @date 2024/8/27 20:03
  * @version 1.0
*/
public class ClimbStairs {
    public static void main(String[] args) {
        int n=5;
        int res=getRes(n);
        System.out.println(res);
    }

    private static int getRes(int n) {
        int[] dp = new int[n+1];
        //初始化
        dp[0]=1;
        dp[1]=1;
        dp[2]=dp[0]+dp[1]; //2
        for (int i = 3; i <= n; i++) {
            dp[i]=dp[i-1]+dp[i-2];
        }
        return dp[n];
    }
}
